<?php 
class DomArTestClass_DomArFile extends DomArObject {

	/**
	* @orm text
	*/
	public $name;
	/**
	* @orm plugin DomArFile()
	* @orm listener beforeAdd beforeAdd(2)
	* @orm listener afterAdd afterAdd(3)
	*/
	public $file;
	/**
	* @orm plugin DomArFile({autoRename=1})
	*/
	public $autoFile;
	/**
	 * @orm plugin DomArFile({autoRename=1,relative=../myDir/})
	 */
	public $autoFileWithRelative;
	/**
	* @orm plugin DomArFile({autoRename=idTree})
	*/
	public $autoFileTree;
	/**
	* @orm plugin DomArFile({autoRename=dir/$method(getName)})
	*/
	public $autoFileMethod;
	
	public $beforeAdd = false;
	public $afterAdd = false;

	public function getName() {
		return '$className/$id/$propertyName';
	}
	
	public function construct( $name ) {
		$this->name = $name;
	}
	
	public function beforeAdd( $path, $arg ) {
		$correctPath = DOMAR_FILE_DEFAULT_PATH.'myFile.txt';
		$path = str_replace('/','\\', $path);
		$correctPath = str_replace('/','\\', $correctPath);
		$this->beforeAdd = $arg == 2 && $path == $correctPath;
	}
	
	public function afterAdd( $arg ) {
		$this->afterAdd = $arg == 3;
	}

}
?>